#ifndef __SPI_H__
#define __SPI_H__


#define SPI1_CLK				RCC_APB2Periph_SPI1
#define SPI1_GPIO				GPIOA
#define SPI1_GPIO_CLK			RCC_APB2Periph_GPIOA
#define SPI1_PIN_SCK			GPIO_Pin_5
#define SPI1_PIN_MISO			GPIO_Pin_6
#define SPI1_PIN_MOSI			GPIO_Pin_7
#define SPI1_PIN_CS          	GPIO_Pin_4


#define SPI2_CLK				RCC_APB1Periph_SPI2
#define SPI2_GPIO				GPIOB
#define SPI2_GPIO_CLK			RCC_APB2Periph_GPIOB
#define SPI2_PIN_SCK			GPIO_Pin_13
#define SPI2_PIN_MISO			GPIO_Pin_14
#define SPI2_PIN_MOSI			GPIO_Pin_15
#define SPI2_PIN_CS          	GPIO_Pin_12


void SPI1_Init (void);
void rt_spi1_close(void);
uint16_t SPI1_SendHalfWord(uint16_t HalfWord);
uint8_t spi1_send_byte(uint8_t byte);
void spi1_cs_enable(void);
void spi1_cs_disable(void);

void SPI2_Init(void);
void rt_spi2_close(void);
uint16_t SPI2_SendHalfWord(uint16_t HalfWord);
void spi2_cs_enable(void);
void spi2_cs_disable(void);

#endif
